home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
amok_lha
/
amok33.lha
/
Wirth
/
Kurven
/
Sierpinski.mod
< prev
next >
Wrap
Text File
|
1993-08-15
|
2KB
|
77 lines
(* -------------------------------------------------------------------------
:Program. Sierpinski
:Author. Kai Bolay
:Address. Hoffmannstraße 168, 7250 Leonberg
:Phone. 07152/22135
:History. v1.00 Initial
:Copyright. PD
:Language. Modula-2
:Translator. M2Amiga 3.2d
:Contents. Introducing: Sierpinski...
------------------------------------------------------------------------- *)
MODULE Sierpinski;
FROM Dos IMPORT Delay;
FROM LineDrawing IMPORT SetXY, Line, width, height;
VAR i, h, x0, y0 : INTEGER;
ciapra [0BFE001H] : SET OF (s0, s1, s2, s3, s4, s5, lmb); (* Mouse *)
PROCEDURE A (k : INTEGER); FORWARD;
PROCEDURE B (k : INTEGER); FORWARD;
PROCEDURE C (k : INTEGER); FORWARD;
PROCEDURE D (k : INTEGER); FORWARD;
PROCEDURE A (k : INTEGER);
BEGIN
IF k > 0 THEN
A (k-1); Line (7, h); B (k-1); Line (0, 2*h);
D (k-1); Line (1, h); A (k-1);
END; (* IF *)
END A;
PROCEDURE B (k : INTEGER);
BEGIN
IF k > 0 THEN
B (k-1); Line (5, h); C (k-1); Line (6, 2*h);
A (k-1); Line (7, h); B (k-1);
END; (* IF *)
END B;
PROCEDURE C (k : INTEGER);
BEGIN
IF k > 0 THEN
C (k-1); Line (3, h); D (k-1); Line (4, 2*h);
B (k-1); Line (5, h); C (k-1);
END; (* IF *)
END C;
PROCEDURE D (k : INTEGER);
BEGIN
IF k > 0 THEN
D (k-1); Line (1, h); A (k-1); Line (2, 2*h);
C (k-1); Line (3, h); D (k-1);
END; (* IF *)
END D;
BEGIN
h := (height DIV 80) * 16;
x0 := width DIV 2; y0 := height DIV 2 + h;
FOR i := 1 TO 4 DO
x0 := x0 - h;
h := h DIV 2;
y0 := y0 + h;
SetXY (x0, y0);
A (i); Line (7, h); B (i); Line (5, h);
C (i); Line (3, h); D (i); Line (1, h);
WHILE lmb IN ciapra DO Delay (10); END;
END; (* FOR *)
END Sierpinski.